package ldkxingzhe.ldkxingzhedemo.service;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by liangdengke on 2015/9/11.
 */
public class Person implements Parcelable{
    private final String TAG = Person.class.getSimpleName();


    private String name, email;
    private int age;
    public static final Parcelable.Creator<Person> CREATOR = new Creator<Person>() {
        @Override
        public Person createFromParcel(Parcel source) {
            return new Person(source);
        }

        @Override
        public Person[] newArray(int size) {
            return new Person[size];
        }
    };

    public Person(){
        this("none Name","none Email",0);
    }
    public Person(String name, String email, int age){
        this.name = name;
        this.email = email;
        this.age = age;
    }

    private Person(Parcel source){
        name = source.readString();
        email = source.readString();
        age = source.readInt();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(email);
        dest.writeInt(age);
    }

    /**
     * 返回 name的值
     *
     * @return value of name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置name
     *
     * @param name 要设置的name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 返回 email的值
     *
     * @return value of email
     */
    public String getEmail() {
        return email;
    }

    /**
     * 设置email
     *
     * @param email 要设置的email
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * 返回 age的值
     *
     * @return value of age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置age
     *
     * @param age 要设置的age
     */
    public void setAge(int age) {
        this.age = age;
    }
}
